1 00:00:00,530 --> 00:00:00,660 Right. 2 00:00:00,690 --> 00:00:06,330 Now, let's add some code so that when somebody presses this button, we're going to get the UI and 3 00:00:06,330 --> 00:00:09,270 we're going to get a message saying, Hey, you could join the bottle or not. 4 00:00:09,270 --> 00:00:15,750 So let's make this UI invisible because we only want to show it when there's a battle being initiated. 5 00:00:15,780 --> 00:00:26,340 I'm going to go back down to screen Gooey Battle Royale frame and then I'll just make that visible unchecked. 6 00:00:28,020 --> 00:00:31,050 Now let's scroll up to the workspace. 7 00:00:31,410 --> 00:00:32,560 Open it here. 8 00:00:32,580 --> 00:00:35,130 We're going to look for our bottle wall. 9 00:00:35,160 --> 00:00:37,290 There it is by the wall. 10 00:00:37,290 --> 00:00:39,850 And I have an initiate battle script. 11 00:00:39,870 --> 00:00:40,830 Let's bring that over. 12 00:00:40,860 --> 00:00:42,150 Let's open that up. 13 00:00:43,620 --> 00:00:43,830 All right. 14 00:00:43,830 --> 00:00:45,660 We're going to need a few variables. 15 00:00:46,260 --> 00:00:49,350 We'll get a variable for replicated storage local. 16 00:00:49,350 --> 00:00:56,760 I'll just call it R's replicated storage game, get service, replicated storage. 17 00:00:56,760 --> 00:01:01,710 And remember, in replicated storage, we have our battle, Ari. 18 00:01:02,640 --> 00:01:03,120 Let's see. 19 00:01:03,120 --> 00:01:09,000 Let's call this battle Ari Replicated storage. 20 00:01:09,000 --> 00:01:12,230 Wait for child Battle royale. 21 00:01:12,240 --> 00:01:14,970 Ari, close enough for our variable. 22 00:01:15,870 --> 00:01:16,110 All right. 23 00:01:16,110 --> 00:01:18,150 We're going to need a queue time. 24 00:01:18,150 --> 00:01:20,010 How long do we want to keep it open? 25 00:01:20,010 --> 00:01:22,020 How long do we want to keep the queue open? 26 00:01:22,170 --> 00:01:24,390 Let's do queue. 27 00:01:24,690 --> 00:01:31,140 Time equals 15, and then we want to have a flag. 28 00:01:31,140 --> 00:01:34,800 If the queues initiated, we don't want to re initiate a queue. 29 00:01:34,830 --> 00:01:36,600 We only want one queue at a time. 30 00:01:36,600 --> 00:01:43,800 So I say is initiated, I will say false. 31 00:01:43,800 --> 00:01:44,490 We'll start that out. 32 00:01:44,490 --> 00:01:45,570 It's false. 33 00:01:46,720 --> 00:01:47,820 You know what else we're going to need? 34 00:01:47,830 --> 00:01:49,450 We're going to need a sound. 35 00:01:49,750 --> 00:01:54,100 I'll just put a variable here for the sound. 36 00:01:54,400 --> 00:01:57,700 Let's make it nil for now. 37 00:01:57,700 --> 00:02:00,110 Let's go find the sound, though. 38 00:02:00,130 --> 00:02:00,430 All right. 39 00:02:00,520 --> 00:02:04,030 So let's go back to our zombie world real quick. 40 00:02:04,210 --> 00:02:12,310 We'll go to the toolbox and in Marketplace took audio and the sound that I had in the demo. 41 00:02:12,340 --> 00:02:13,360 I kind of like that. 42 00:02:13,360 --> 00:02:15,880 I don't like to look around for stuff like that, like sounds. 43 00:02:16,000 --> 00:02:18,730 I'm going to do a public underscore. 44 00:02:19,010 --> 00:02:21,100 I think I call that places. 45 00:02:23,880 --> 00:02:24,500 There it is. 46 00:02:24,510 --> 00:02:25,350 This is the one. 47 00:02:25,350 --> 00:02:26,340 This is the one. 48 00:02:30,130 --> 00:02:31,360 I kind of like that. 49 00:02:31,600 --> 00:02:34,630 I'm going to put that in my bottle wall. 50 00:02:35,170 --> 00:02:36,580 Go ahead and insert. 51 00:02:38,180 --> 00:02:40,400 Now because I didn't put that on a part. 52 00:02:40,400 --> 00:02:44,690 It's going to reverberate throughout the entire entire game, right? 53 00:02:44,690 --> 00:02:47,780 So if you put it on a part, you're going to get that sound roll off. 54 00:02:47,780 --> 00:02:51,620 If you just put it under a model, you're not going to get the sound roll off. 55 00:02:51,620 --> 00:02:52,400 And that's what I want. 56 00:02:52,400 --> 00:02:58,340 I want everybody on this whole and this whole workspace to be able to hear it so they can accept the 57 00:02:58,340 --> 00:02:59,840 battle if they want to fight. 58 00:03:01,630 --> 00:03:07,810 So let's go back to our script, initiate battle script, and we can go ahead and put that sound in 59 00:03:07,840 --> 00:03:08,330 there. 60 00:03:08,350 --> 00:03:13,070 We have our script parent and then we could rename it. 61 00:03:13,090 --> 00:03:14,250 I'm not going to, though. 62 00:03:14,290 --> 00:03:15,340 I'm just going to do this. 63 00:03:15,340 --> 00:03:21,040 Public Places Announcement Tone Reverberate 004. 64 00:03:21,130 --> 00:03:22,030 That's all right. 65 00:03:22,030 --> 00:03:26,500 We're going to use the we're going to use the variable that I have S and D. 66 00:03:27,740 --> 00:03:30,200 Let's go down to start registration now. 67 00:03:30,200 --> 00:03:35,240 This fire is off when we hit the click detector, the little green button on the bottle wall. 68 00:03:35,930 --> 00:03:40,970 I'm going to check to see if a battle is initiated already. 69 00:03:40,970 --> 00:03:48,980 So if not is initiated, then we can go ahead and initiate a bottle. 70 00:03:48,980 --> 00:03:53,570 We don't want to initiate a battle if there is already one initiated. 71 00:03:53,570 --> 00:03:56,120 So let's go to format, format, document. 72 00:03:56,120 --> 00:03:56,960 There we go. 73 00:03:56,960 --> 00:04:04,520 So as soon as we get in this, if statement, we're going to say is initiated is now true and once we 74 00:04:04,550 --> 00:04:12,170 send, all of our players will say initiated equals false. 75 00:04:12,260 --> 00:04:14,690 Now we're going to do a few more things. 76 00:04:15,320 --> 00:04:18,350 Like one, we've got to play our announcement. 77 00:04:18,350 --> 00:04:26,030 So we have our sound colon play and we can insert our players in there. 78 00:04:27,720 --> 00:04:28,170 You know what? 79 00:04:28,170 --> 00:04:33,720 Let's go ahead and just comment this out for now. 80 00:04:35,870 --> 00:04:39,260 And then because we want to put the players in if they accept. 81 00:04:39,740 --> 00:04:43,160 And this is just for one player anyway, the person who started the registration. 82 00:04:43,160 --> 00:04:48,470 And I'm not going to make it so that if you start the registration, you have to be in the battle. 83 00:04:48,470 --> 00:04:52,340 You just hit the button, you get it going, you still have to accept. 84 00:04:52,340 --> 00:04:55,160 So you could still not be in the battle if you wanted to be. 85 00:04:55,160 --> 00:04:56,840 I thought that would be the best way. 86 00:04:57,020 --> 00:04:57,320 All right. 87 00:04:57,320 --> 00:04:59,750 So I got my bottle, Ari. 88 00:05:00,170 --> 00:05:03,320 And then what I'm going to do is fire all clients. 89 00:05:03,320 --> 00:05:09,560 That's going to send a message to everybody's UI in the game, everybody's player in the game. 90 00:05:09,560 --> 00:05:13,790 So I don't have to put a player in here, but I am going to send the queue time. 91 00:05:15,720 --> 00:05:22,680 Then I'm going to go down here and I will wait the queue time. 92 00:05:24,650 --> 00:05:29,000 Also for now I'm going to comment out, send players. 93 00:05:29,120 --> 00:05:31,520 I want to try this out in studio. 94 00:05:31,520 --> 00:05:35,750 And if you'll recall, the teleport service set it right. 95 00:05:35,750 --> 00:05:39,100 The Teleport Service does not work in studio. 96 00:05:39,110 --> 00:05:41,840 You have to do that in when you're playing your game. 97 00:05:41,840 --> 00:05:43,190 On the roadblocks player. 98 00:05:44,360 --> 00:05:50,300 Now let's capture this remote event on the client side so we can bring up our UI. 99 00:05:50,330 --> 00:05:56,900 What I'm going to do is I'm going to go up here and I'm going to copy these two lines. 100 00:05:58,070 --> 00:05:59,840 Right click copy. 101 00:06:00,320 --> 00:06:02,150 And I go down to my. 102 00:06:03,720 --> 00:06:04,980 Starter. 103 00:06:05,340 --> 00:06:06,120 C Starter. 104 00:06:06,120 --> 00:06:06,510 Gooey. 105 00:06:06,510 --> 00:06:07,470 Screen Gooey. 106 00:06:07,500 --> 00:06:09,330 Battle Royale Frame. 107 00:06:09,690 --> 00:06:12,540 I'll go ahead and put the script right on the frame. 108 00:06:12,540 --> 00:06:14,610 Remember, we want a local script. 109 00:06:16,010 --> 00:06:16,820 There we go. 110 00:06:17,210 --> 00:06:19,250 And let's call this. 111 00:06:21,400 --> 00:06:23,140 Battle local. 112 00:06:23,170 --> 00:06:28,030 How about that battle royale? 113 00:06:28,310 --> 00:06:33,040 Luke All right, now we have that print statement. 114 00:06:33,040 --> 00:06:34,470 Let's go ahead and do a control V. 115 00:06:34,480 --> 00:06:38,380 I'll make this a little bigger so you could see it. 116 00:06:39,780 --> 00:06:42,360 First thing we want to do is pop up that. 117 00:06:42,360 --> 00:06:43,380 Pop up that window. 118 00:06:43,380 --> 00:06:43,860 Right. 119 00:06:43,890 --> 00:06:44,880 Local. 120 00:06:45,330 --> 00:06:50,970 I'll do Battle Ephrem and we'll do a script. 121 00:06:51,000 --> 00:06:52,560 Dot Parent. 122 00:06:52,560 --> 00:06:54,360 That's the battle frame. 123 00:06:54,360 --> 00:06:56,250 And I'll do this. 124 00:06:56,670 --> 00:06:57,270 What is it? 125 00:06:57,270 --> 00:06:59,120 Battle RC is a remote event. 126 00:06:59,130 --> 00:06:59,670 That's it. 127 00:06:59,670 --> 00:07:07,170 Battle Re on client event Connect function. 128 00:07:07,170 --> 00:07:09,720 Remember we're going to get the queue time. 129 00:07:11,400 --> 00:07:20,670 It's like 15 seconds or something and then I'll get my battle frame Visible equals true. 130 00:07:21,120 --> 00:07:21,540 All right. 131 00:07:21,540 --> 00:07:22,710 And then I'm going to do a for loop. 132 00:07:22,710 --> 00:07:24,480 I'm going to do for I. 133 00:07:24,480 --> 00:07:25,770 I'm going to go in reverse order. 134 00:07:25,770 --> 00:07:33,840 So I'm going to go I equals the queue time, which is 15 will go down to zero in steps of negative one. 135 00:07:35,490 --> 00:07:38,730 And then we have our battle label, right? 136 00:07:38,730 --> 00:07:40,350 The the label. 137 00:07:41,070 --> 00:07:43,410 I need a variable for that. 138 00:07:43,410 --> 00:07:50,670 So we need to go let's do that battle label. 139 00:07:50,670 --> 00:07:52,920 So it's on the battle frame. 140 00:07:52,920 --> 00:07:59,900 We got that and then we're going to go down one level Battle Royale label. 141 00:07:59,910 --> 00:08:00,870 That's it. 142 00:08:02,840 --> 00:08:05,480 We'll get our battle label. 143 00:08:08,320 --> 00:08:10,750 And then we had the text on the bottle label. 144 00:08:10,750 --> 00:08:12,160 That's what we're going to change. 145 00:08:12,160 --> 00:08:14,830 And we'll say something like Battle. 146 00:08:15,670 --> 00:08:16,600 I'll just make it short. 147 00:08:16,600 --> 00:08:18,940 Battle in dot, dot, dot. 148 00:08:20,020 --> 00:08:25,570 We'll do a string concatenate, which is two dots, and then we'll put the I, and then you can put 149 00:08:25,570 --> 00:08:26,740 like seconds if you want. 150 00:08:26,740 --> 00:08:31,900 But you're going to see the countdown right o and make sure the countdown is one second by doing a weight. 151 00:08:33,070 --> 00:08:33,520 All right. 152 00:08:33,520 --> 00:08:34,510 That's pretty cool. 153 00:08:34,510 --> 00:08:36,430 Let's go ahead and try this out. 154 00:08:37,850 --> 00:08:39,110 I'm going to play the game. 155 00:08:39,590 --> 00:08:40,730 Hit the play button. 156 00:08:43,170 --> 00:08:44,310 And there we go. 157 00:08:44,340 --> 00:08:45,570 You blew your streak. 158 00:08:46,740 --> 00:08:48,540 I've not been very good at my street. 159 00:08:49,450 --> 00:08:50,140 Oh, what happened? 160 00:08:50,170 --> 00:08:50,860 There we go. 161 00:08:53,720 --> 00:08:58,220 See our our kills death leaderboards a little bit in a way that decline. 162 00:08:58,220 --> 00:09:01,520 You can hit the tab button to make it go away. 163 00:09:01,550 --> 00:09:03,740 We might want to make that a little smaller. 164 00:09:04,730 --> 00:09:09,020 And of course, these don't do anything yet, but that's pretty cool. 165 00:09:09,740 --> 00:09:14,330 We should make this we should make this go away at the end of the 15 seconds. 166 00:09:14,330 --> 00:09:15,410 Let's do that. 167 00:09:15,440 --> 00:09:16,460 Hit the stop. 168 00:09:18,180 --> 00:09:20,160 And we'll go to Battle Royale. 169 00:09:20,190 --> 00:09:21,030 Luke. 170 00:09:23,040 --> 00:09:33,090 And then at the end we will say battle frame dot visible equals false.